In multi-threaded systems, contention can arise between threads for access to the same memory address or object. To avoid such contention, transactional memory systems may be employed. Transactional memory allows programmers to specify regions of the program that must appear to execute atomically. Transactional memory implementations then optimistically execute these transactions concurrently in different threads to obtain higher performance than serial code. Weak atomicity guarantees that one transaction will not interfere with another transaction. To implement weak atomicity, read and write barriers may be implemented in code for transactions.
Strong atomicity (also known as strong isolation) guarantees that transactions are isolated from non-transactional accesses. This provides a strong guarantee to the programmer that no other thread can interfere with the state observed or modified by a transaction until the transaction commits. Implementations of strong atomicity in software are often perceived as being expensive because the compiler instruments non-transactional memory accesses with high-overhead barrier operations. For this reason, many software transactional memory systems (STMs) provide only weak atomicity guarantees.